package com.tanhua.admin.controller;

import com.tanhua.admin.service.AnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dashboard")
public class AnalysisController {

    @Autowired
    private AnalysisService analysisService;

    /**
     * 首页-概要信息统计
     * GET /dashboard/summary
     */
    @GetMapping("/summary")
    public ResponseEntity summary(){

        return analysisService.summary();
    }
    /**
     * 首页-折线图统计 新增、活跃用户、次日留存率
     *  @param sd 开始时间，毫秒值
     *  @param ed 结束时间，毫秒值
     *  @param type 统计类型。101新增， 102活跃用户， 103次日留存率
     * GET /dashboard/users
     */
    @GetMapping("/users")
    public ResponseEntity users(Long sd, Long ed, Integer type){

        return analysisService.users(sd,ed,type);
    }
}
